<%@ page import="com.hrm.entity.AdminEntity" %><%--
  Created by IntelliJ IDEA.
  User: zekdot
  Date: 20-3-10
  Time: 下午5:27
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <%--<style>--%>
        <%--#inp{--%>
            <%--font-family: 微软雅黑,宋体,Arial,Helvetica,Verdana,sans-serif;--%>
            <%--font-weight:bold;--%>
            <%--margin-left: 30%;--%>
            <%--margin-top: 20%;--%>
        <%--}--%>
    <%--</style>--%>
    <script src="${pageContext.request.contextPath}/js/jquery.min.js"></script>
    <link href="${pageContext.request.contextPath}/css/main.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <%
       Object object = session.getAttribute("user");
    %>
    <div class="div_form">
        <h1 class="h1_style"><i class="i_h1"></i> 密码修改</h1>
        <div class="div_left">

            <form id="form_demo"  class="form_b">
                <p class="form_p"><label class="form_label">原密码：</label>
                    <input type="password" class="form_input1 " id="oriPassword" minlength="2"  required>
                </p>
                <p class="form_p"><label class="form_label">新密码：</label>
                    <input type="password" class="form_input1 " id="newPassword" minlength="2"  required>
                </p>
                <p class="form_p"><label class="form_label">确认新密码：</label>
                    <input type="password" class="form_input1 " id="newPassword1" minlength="2"  required>
                </p>
            </form>
            <div class="clear"></div>
            <form id="form_demo1"  class="form_b">
                <p class="but_p">
                    <input type="button" id="sub" value="保存" class="but_save"/>
                </p>
            </form>
        </div>
    </div>
    <%--<table border="1" id="inp">--%>
        <%--<tr>--%>
            <%--<td class="key-font">原密码</td>--%>
            <%--<td><input type="password" ></td>--%>
        <%--</tr>--%>
        <%--<tr>--%>
            <%--<td class="key-font">新密码</td>--%>
            <%--<td><input type="password" id="newPassword"></td>--%>
        <%--</tr>--%>
        <%--<tr>--%>
            <%--<td class="key-font">确认新密码</td>--%>
            <%--<td><input type="password" id="newPassword1"></td>--%>
        <%--</tr>--%>
        <%--<tr>--%>
            <%--<td colspan="2">--%>
                <%--<button id="sub">提交</button>--%>
            <%--</td>--%>
        <%--</tr>--%>
    <%--</table>--%>
    <script>
        $('#sub').click(function(){
            if($('#newPassword').val() != $('#newPassword1').val()){
                alert('两次新密码输入不一致');
                return;
            }
            var data = {'oriPassword':$('#oriPassword').val(),'newPassword':$('#newPassword').val()};
            // alert(JSON.stringify(data))
            $.post('${pageContext.request.contextPath}/<%=object.getClass() == AdminEntity.class?"admin":"employee"%>/changePassword',data,function(str) {
                var res = eval('(' + str + ')');
                if (res.code != 0) {
                    alert(res.message);
                } else {
                    alert('修改成功');
                }
            });
        });
    </script>
</body>
</html>
